﻿<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>用户基本信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
      <style type="text/css">
        .btabs
        {
            border: 1px solid #8DB2E3;
            font-size: 12px;
            height: 31px;
            list-style-type: none;
            width: 100.2%;
            background-color: #E0ECFF;
        }
    </style>
    <script src="../JS1/easyUI/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../JS1/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../JS1/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
    <script src="../JS1/ljxpage.js" type="text/javascript"></script>
    <link href="../JS1/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" /> 
    <link href="../JS1/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../JS1/css/default.css" rel="stylesheet" type="text/css" />

    <script type="text/javascript">
        $(document).ready(function () {
            //定义功能按钮是否可见
            setbutton();
        });

        //弹出信息窗口 title:标题 msgString:提示信息 msgType:信息类型 [error,info,question,warning]
        function msgShow(title, msgString, msgType) {
            $.messager.alert(title, msgString, msgType);
        }
        $(function () {
            InitGird(0);
            InitSearch();
            $('#ljxwin').dialog({
                closed: true,
                title: '用户基本信息'
            });
            $('#status').combobox({
                url: 'ashx/com_user.ashx?type=combox&comboxname=status',
                valueField: 'xianshizhi',
                textField: 'xianshizhi'
            });

            $('#orgid').combotree({
                lines: true,//显示虚线效果
                url: 'ashx/com_user.ashx?type=comboxtree&comboxname=orgid',
                required: true,
                onSelect:function(node){
                    $('#orgname').val(node.text);
                }
                 
            });
            initpower();
        });
        function initpower() {
     
            document.getElementById("mypower").innerText = GetQueryString("rolename");
            $('#roleid').val(GetQueryString("roleid"));
        }

        //初始化表格
        function InitGird(parsend) {
            $('#tab_list').datagrid({
                title: '用户基本信息', //表格标题
                url: 'ashx/com_user.ashx?mysearch=' + parsend, //请求数据的页面
                //   sortName: '产品名称', //排序字段
                idField: 'Id', //标识字段,主键
                iconCls: '', //标题左边的图标
                width: '100%', //宽度
                singleSelect: false,
                nowrap: false, //是否换行，True 就会把数据显示在一行里
                striped: true, //True 奇偶行使用不同背景色
                collapsible: false, //可折叠
                sortOrder: 'desc', //排序类型
                remoteSort: false, //定义是否从服务器给数据排序

                columns: [[
                         
                          { field: 'Id', title: '序号', checkbox:true,width: $(this).width() * 0.125 * 2 / 3, align: 'center' },
                          { field: 'userid', title: '用户编号', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'logincount', title: '登录帐号', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'username', title: '用户姓名', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'password', title: '密码', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'usertype', title: '类别', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'status', title: '状态', width: $(this).width() * 0.125, align: 'center' },
                          { field: 'orgname', title: '部门名称', width: $(this).width() * 0.125, align: 'center' }

                ]],
                onDblClickCell: function () {
                    edit();
                },
                queryParams: { "action": "query" },
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 30, //默认一页数据条数
                rownumbers: true //行号
            });

        }
        //初始化搜索框
        function InitSearch() {
            $("#ipt_search").searchbox({
                width: 200,
                iconCls: 'icon-save',
                searcher: function (val, name) {
                    $('#tab_list').datagrid('options').queryParams.search_type = name;
                    $('#tab_list').datagrid('options').queryParams.search_value = val;
                    $('#tab_list').datagrid('reload');
                },
                prompt: '请输入要查询的账号'
            });
        }

      
        //添加/保存 信息
        function save() {
           var ss =  getSelections();
 
            //var Id = $('#HdId').val();
           $.post('ashx/com_user.ashx?type=powersave&idlist=' + encodeURI(ss) + '&roleid=' + encodeURI($('#roleid').val()), function (msg) {

                msgShow('系统提示', '权限设置成功', 'info');
            
                $('#tab_list').datagrid('reload');
            });
        }
        function getSelections() {
            var ss = '';
            var rows = $('#tab_list').datagrid('getSelections');//$('#tab_list').datagrid('getSelected');

            for (var i = 0; i < rows.length; i++) {
                var row = rows[i];
                ss = ss +  row.userid + ':';
            }
            return ss;
        }
    </script>
</head>
<body  style="background:white">
    <form>
    <input id="HdId" type="hidden" />
    <!--工具栏-->
    <div class="btabs">
         <table width="100%">
            <tr>
                <td style="text-align: left;">
                    <table>
                        <tr>
                            <td id="help" >
                                <div class="datagrid-btn-separator"></div>
                                <a class="easyui-linkbutton" iconcls="icon-help" plain="true"  onclick="add()" target="_blank">帮助</a>
                            </td>
                            <td id="ljxfun1">
                                <a class="easyui-linkbutton" iconcls="icon-add1" plain="true" onclick="save()">保存</a>
                            </td>
                            <td id="ljxfun2">
                                <a class="easyui-linkbutton" href="RolesList.html" iconcls="icon-add1" plain="true" onclick="save()">返回</a>
                            </td>                            
                            <td id="ljxfun4"> 
                                <div class="datagrid-btn-separator"></div>   &nbsp;  <a  class="easyui-linkbutton" iconcls="icon-pencil" plain="true"  onclick="InitGird(1)">显示全部</a> 
                            </td>
                            <td id="Td1" style="width:300px; color: #FF0000; font-weight: bold;"> 
                                <div class="datagrid-btn-separator"></div> &nbsp;  &nbsp;   授权角色： &nbsp;   <span id="mypower">
                                
                                </span><input id="roleid" type="hidden" />
                            </td>
                        </tr>
                    </table>
                           
                </td>
                <td style="text-align: right; padding-right: 2px">
                      <input id="ipt_search" menu="#search_menu" />
                    <div id="search_menu" style="width:120px">
                        <div name="userid">
                            用户编号</div>
                        <div name="logincount">
                            登录帐号</div>
                        <div name="username">
                            用户姓名</div>
                        <div name="status">
                            状态</div>
                    </div>

                </td>
            </tr>
        </table>
    </div>
    <div id="div2" style="width: 100.5%">         
        <table id="tab_list"  style="height: auto" >
        </table>         
    </div>
     
  
    </form>
</body>
</html>
 